package fei.yuzhi.com.loveflowers.fragment.firstpagefragment.autoscroll;

import java.util.List;

import fei.yuzhi.com.loveflowers.bean.firstpageautobean.FirstAutoBean;
import fei.yuzhi.com.loveflowers.bean.firstpageautobean.ItemBean;
import fei.yuzhi.com.loveflowers.utils.FirstPageHttpUtils;

/**
 * Created by My on 2016/10/10.
 */
public class AutoScrollJumpModel implements AutoScrollJumpContract.AutoScrollModel {

    @Override
    public void getGridViewData(final String data, final setOnGetGridViewDataLsitener onGetGridViewDataLsitener) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                FirstPageHttpUtils.getFirstAutoBean(data, new FirstPageHttpUtils.onGetFirstAutoBean() {
                    @Override
                    public void getFirstAutoBeanFromNet(FirstAutoBean firstAutoBean) {
                        List<ItemBean> itemBeanList=firstAutoBean.getDatas().get(0).getGoods().getItem();
                        String title=firstAutoBean.getDatas().get(0).getGoods().getTitle();
                        onGetGridViewDataLsitener.getGridData(itemBeanList,title);
                    }
                });
            }
        }).start();
    }

    public  interface setOnGetGridViewDataLsitener{
        void getGridData(List<ItemBean> itemBeanList,String title);
    }
}
